package com.fc.mall.decoration.link.model;

import com.fc.mall.decoration.link.object.LinkStatus;
import com.fc.mall.mongo.model.VersionedObject;
import com.fc.mall.util.Utils;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

@Getter
@Setter
@Document(collection = "links")
public class Link extends VersionedObject {
    @Id
    private String id;

    @Indexed
    private String name;

    private String expression;

    private LinkStatus status;

    public static Link createNew() {
        Link link = new Link();
        link.setId(Utils.generateId());
        return link;
    }
}
